Skip to content

Conversation

@AlexeySachkov
Copy link
Contributor

When free function kernel defined as a template has an argument whose type is an alias, we need to look into the underlying type, or otherwise we emit nonsense.

When free function kernel defined as a template has an argument whose
type is an alias, we need to look into the underlying type, or otherwise
we emit nonsense.
@AlexeySachkov AlexeySachkov requested a review from a team as a code owner November 20, 2025 14:47
// CHECK: void baz_type(ns::Bar<double, float> Arg);

#if 0
// This test case fails, but it is added here in advance to add a record of a
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: this is an additional test case that I came up with, it was not (at least yet) reported by any customer. I do have a work-in-progress patch for it, but it requires bigger changes to address.

I'm adding the known failing test case right now, proceeding with the simpler patch to unblock the reporter. The extra issue that I found will be addressed in a separate PR

}

const TemplateSpecializationType *TSTAsNonAlias =
TST->getAsNonAliasTemplateSpecializationType();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that work for nested aliases? i.e. alias for alias?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note here. Nested alias is needed for pytorch. Please check below code from https://github.com/pytorch/pytorch/blob/a7f3b10866098c452d89cd7a30bc4ce5713b8319/aten/src/ATen/core/TensorAccessor.h#L45

template<typename T, size_t N, template <typename U> class PtrTraits = DefaultPtrTraits, typename index_t = int64_t>
using TensorAccessor = torch::headeronly::detail::TensorAccessor<c10::IntArrayRef, T, N, PtrTraits, index_t>;
...
template<typename T, size_t N, template <typename U> class PtrTraits = DefaultPtrTraits, typename index_t = int64_t>
using GenericPackedTensorAccessor = torch::headeronly::detail::GenericPackedTensorAccessor<TensorAccessor<T, N-1, PtrTraits, index_t>, detail::IndexBoundsCheck<N, index_t>, T, N, PtrTraits, index_t>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that work for nested aliases? i.e. alias for alias?

Yes, looking at the implementation it unwraps all aliases, I've also added a test case in 99174d6

@AlexeySachkov
Copy link
Contributor Author

The second commit only altered clang tests, so I will treat all failures in the second CI run as unrelated.

In the first CI run the following tests failed:

Timed Out Tests (2):
  SYCL :: Basic/vector/vec_binary_scalar_order_logical.cpp
  SYCL :: USM/copy.cpp

However, they don't use free function kernels and all this patch does is change how we generate integration header for free function kernels. As such, I'm going to treat these two as unrelated failures as well and proceed with merge

@AlexeySachkov AlexeySachkov merged commit 7dc6a5e into intel:sycl Nov 21, 2025
26 of 29 checks passed
@AlexeySachkov AlexeySachkov deleted the private/asachkov/one-more-fix-for-aliases-and-free-function-kernels branch November 21, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants